package com.legsem.jhosync.ws.rs;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;

import com.legsem.jhosync.Server;

@Path("logout")
public class LogoutResource extends AbstractResource {

    @POST
    public Response clientLogout(@Context HttpServletRequest req) {
        try {
            Server server = getServer(req);
            server.doLogout();
            return Response.ok().build();

        } catch (Exception e) {
            throw new WebApplicationException(e,
                    Response.Status.INTERNAL_SERVER_ERROR);
        }
    }
}
